package com.ler.yrmall.product.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.ler.yrmall.basic.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * @author leron
 */
@Data
@TableName("pms_spu")
@EqualsAndHashCode(callSuper = true)
public class SpuEntity extends BaseEntity<SpuEntity> {

    /**
     * 名称
     */
    private String name;

    /**
     * 所属分类
     */
    private Long categoryId;

    /**
     * 所属品牌
     */
    private Long brandId;

    /**
     * 重量
     */
    private BigDecimal weight;

    /**
     * 上架状态
     * @see SpuStatus
     */
    private Integer status;

    /**
     * 主图片
     */
    private String mainImg;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * spu 状态
     */
    public enum SpuStatus {

        /**
         * 状态
         */
        CREATED(0,"新建"),

        ON_SALE(1,"上架"),

        SOLD_OUT(2,"下架");

        private final Integer code;

        private final String dict;

        SpuStatus(Integer code, String dict) {
            this.code = code;
            this.dict = dict;
        }

        public Integer getCode() {
            return code;
        }

        public String getDict() {
            return dict;
        }
    }

}
